package com.alex.goods.controller;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/admin")
public class AdminServlet extends BasicServlet {

	private static final long serialVersionUID = 1L;

	public void page(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.getRequestDispatcher("/WEB-INF/index.html").forward(request, response);
//		response.sendRedirect("/WEB-INF/index.html");
	}

	public void goodsPage(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.getRequestDispatcher("/WEB-INF/goodsPage.html").forward(request, response);
//		response.sendRedirect("/WEB-INF/goodsPage.html");
	}
	public void orderPage(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.getRequestDispatcher("/WEB-INF/orderPage.html").forward(request, response);
//		response.sendRedirect("/WEB-INF/orderPage.html");
	}
	
	
	public void sumPage(HttpServletRequest request, HttpServletResponse  response) throws ServletException, IOException {
	   request.getRequestDispatcher("/WEB-INF/sumPage.html").forward(request,response);
//	   response.sendRedirect("/WEB-INF/sumPage.html");
	}

	public void logouts(HttpServletRequest req, HttpServletResponse res) throws Exception{

		req.getSession().removeAttribute("currentname");
	//	res.sendRedirect("/userLogin.jsp");
		System.out.println("this is ok ****************");
		res.sendRedirect("/login");

	}

	public void trash(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {

		request.getRequestDispatcher("/WEB-INF/trash.html").forward(request,response);

//		response.sendRedirect("/WEB-INF/trash.html");
	}
}
